Repository navigation
Fix poll functions on sockets not properly registering the waker. - #2535
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2535 +/- ##
==========================================
- Coverage 79.06% 79.05% -0.02%
==========================================
Files 132 132
Lines 26985 26990 +5
==========================================
+ Hits 21336 21337 +1
- Misses 5649 5653 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
How is an infinite loop (which would be hard to troubleshoot, perhaps) avoided in this scenario? |
|
It is not, we assume the OS behaves somewhat reasonable and doesn't endlessly signal a non-ready socket as ready. |
|
I think it's important to realize that try_io catches any WouldBlock error returned from the inner function and then clears the ready flag (in tokio). Meaning that the |
|
I would suggest adding the assumption in a comment in the source code. (I agree that it's not a real problem.). Can save debugging if someone else is troubleshooting in this neck of the woods 3 years from now. :-) |
When poll_x_ready returned ready, but the try_io function failed with a wouldblock error, we would return std::task::Poll::Pending without properly registering the waker. Retrying the operation as a whole in that case is a better way to ensure the waker does get registered.
17af724 to
4660184
Compare
|
Have added the requested comment, but that means this will need a second review |
When poll_x_ready returned ready, but the try_io function failed with a wouldblock error, we would return std::task::Poll::Pending without properly registering the waker. Retrying the operation as a whole in that case is a better way to ensure the waker does get registered.